<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/jedate.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/fonts/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/common.css"/>
		
	</head>
	<body>
		<div class="container-fluid">
			<div class="row mheader">
				<div class="col-xs-2 text-left"><a href="javascript:;" onclick="javascript:history.back(-1);"><span class="iconfont icon-fanhui"></span></a></div>
				<div class="col-xs-8"><h2>材料供货单供货详情</h2></div>
				<div class="col-xs-2 text-right"> <a href="#" onclick="shenhe()">审核</a> </div>
			</div>
			<div class="row">
				<dl class="erp-list erp-details">
					<dd>
						<div class="erp-txt">
						</div>
					</dd>
				</dl>
				
				<dl class="erp-order xerp-order">
					<dt>材料供货单供货明细</dt>
					<div id="detail">
					</div>
					<div class="moreBox">
						<a href="javascript:;" class="more">显示更多
							<!--<span class="iconfont icon-jiantou2"></span>-->
						</a>
					</div>
				</dl>
			</div>
		</div>
	</body>
</html>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="../../../resource/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../resource/js/style.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

	//点击改变申请单显示于隐藏
	$(document).ready(function(){
		  $(".more").click(function(){
		    $(this).parents(".xerp-order").toggleClass("xerpShow");
		    
		  });
	});
	//点击改变申请单高度
	$(document).ready(function(){
		  $(".more").click(function(){
		    $(this).siblings(".order-li").toggleClass("orderHeight");
		  });
	});

	$(function(){
        load();
	})
    var remark=window.location.href.split("?")[1];
	function load(){
		ajaxs(
		    'api/matperson/loadghMoudle.do',
			'post',
			{
                type:'c',
                remark:remark,
                p:getP()
			},
			function(data){
		        console.log(data)
				var json=data.data;
				//渲染主要数据
				var ZT=sessionStorage.zhuangtais;
				var qianshouZT='';
                if(ZT==-1){
                    qianshouZT="等待签收";
                }else  if(ZT==0){
                    qianshouZT="已签收";
                }else{
                    qianshouZT="拒绝签收";
                }

				$('.erp-txt').append('<p><span>项目名称:</span>'+json[0].proName+'</p>' +
                    '<p><span>施工单位:</span>'+json[0].compName1+'</p>' +
                    '<p><span>收货地址:</span>'+json[0].r_adr+'</p>' +
                    '<p><span>供货时间:</span>'+json[0].rCreateTime+'</p>'+
                    '<p><span>签收状态:</span>'+qianshouZT+'</p>');
				//判断是否显示审核按钮
				if(json[0].rState !=-1||json[0].rValidate==1){
				    $('.text-right').hide();
				}else{
                    $('.text-right').show();
				}
                if(json.length>1){
                    $('.moreBox').show();
                }else{
                    $('.moreBox').hide();
                }
				for(var i=0;i<json.length;i++){
                    if(json[i].validate==-1 || json[i].validate==undefined){
                        json[i].validate="等待审核";
                    }else  if(json[i].validate==0){
                        json[i].validate="已审核";
                    }else{
                        json[i].validate="审核不通过";
                    }
                    var xiaoji=0;
                    json[i].mat_Bit=='根'?xiaoji=json[i].old_Price*json[i].fin_Num*6:xiaoji=json[i].old_Price*json[i].fin_Num;
                    if(!json[i].rm_Num){
                        json[i].rm_Num='';
					}

					$('#detail').append('<dd>' +
                        '<p><span>材料名称:</span>'+json[i].mat_Name+'</p>' +
                        '<div class="order-li clearfix">' +
                        '<div class="col-xs-6"><span>材料规格:</span>'+json[i].mat_Spec+'</div>' +
                        '<div class="col-xs-6"><span>单价:</span>'+json[i].old_Price+'元</div>' +
                        '<div class="col-xs-6"><span>计量单位:</span>'+json[i].mat_Bit+'</div>' +
                        '<div class="col-xs-6"><span>送料数量:</span>'+json[i].send_Num+'</div>' +
                        '<div class="col-xs-6"><span>签收数量:</span>'+json[i].rm_Num+'</div>' +
                        '<div class="col-xs-6"><span>审批数量:</span>'+json[i].fin_Num+'</div>' +
                        '<div class="col-xs-6"><span>录入人员:</span>'+json[i].rCreateUser+'</div>' +
                        '<div class="col-xs-6"><span>小计:</span>'+xiaoji+'元</div>' +
                        '<div class="col-xs-6"><span>审核状态:</span>'+json[i].validate+'</div>' +
                        '<div class="col-xs-6"><span>备注:</span>'+(json[i].reMarks==undefined?"无":json[i].reMarks)+'</div>' +
                        '<!--<div class="col-xs-6 text-right"><span>采购人:</span><strong>张三</strong><span></span></div>-->' +
                        '</div>' +
                        '' +
                        '</dd>')
				}
			}
		)
	}
	//点击审核  跳转页面
	function shenhe(){
	    window.location.href="./erp-delivery.html?"+remark;
	}
</script>











